package com.ehome.emergency.entities;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * BasicFramework
 *
 * @author: haoxiaolei
 * @date: 2016-07-06 17:39
 * @desc: 日志
 */
@Entity
@Table(name = "share_logs")
@DynamicInsert
@DynamicUpdate
public class Logs implements Serializable {
    private static final long serialVersionUID = -8267162247977118668L;

    //成员变量**********************************************************************
    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "share_logs_id_generator", strategy = "native")
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * 执行的方法全称
     */
    @Column(name = "method")
    private String method;
    /**
     * 返回结果值
     */
    @Lob
    @Basic(fetch= FetchType.LAZY)
    @Type(type = "org.hibernate.type.MaterializedClobType")
    @Column(name = "result", columnDefinition = "CLOB")
    private String returnVal;
    /**
     * 方法执行开始时间，毫秒
     */
    @Column(name = "start_time")
    private Long startTime;
    /**
     * 方法执行结束时间，毫秒
     */
    @Column(name = "end_time")
    private Long endTime;
    /**
     * 用时时间，毫秒
     */
    @Column(name = "taking_time")
    private Long takingTime;
    /**
     * 账号Id
     */
    @Column(name = "account_id")
    private Long accountId;
    /**
     * 账号名称
     */
    @Column(name = "account_name", length = 20)
    private String accountName;
    /**
     * 日志入库时间，时间戳
     */
    @Column(name = "create_time")
    private Long createTime;
    /**
     * 类型，EXCEPTION, SUCCESS
     */
    @Column(name = "type", length = 15)
    private String type;


    //setter/getter****************************************************************
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getReturnVal() {
        return returnVal;
    }

    public void setReturnVal(String returnVal) {
        this.returnVal = returnVal;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    public Long getTakingTime() {
        return takingTime;
    }

    public void setTakingTime(Long takingTime) {
        this.takingTime = takingTime;
    }

    public Long getAccountId() {
        return accountId;
    }

    public void setAccountId(Long accountId) {
        this.accountId = accountId;
    }

    public String getAccountName() {
        return accountName;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
}
